#[allow(unused)]
fn main() {
    let open = my::OpenBox { contents: "foobar" };
    println!("Hello, world!{}", open.contents);
    // let closed = my::OpenBox::content;
    let closed = my::ClosedBox::new("hello closed");
    // 构造体的私有属性不能对外访问
    // println!("hello closed ={}", closed)
}

#[allow(dead_code)]
mod my {
    pub struct OpenBox<T> {
        pub contents: T,
    }

    pub struct ClosedBox<T> {
        content: T,
    }

    impl<T> ClosedBox<T> {
        /// Creates a new [`MM<T>`].
        pub fn new(content: T) -> ClosedBox<T> {
            ClosedBox { content: content }
        }
    }
}
